package br.com.amethyst.workflow;

import br.com.amethyst.workflow.source.IWorkflowSource;
import br.com.amethyst.workflow.source.KeplerSource;
import br.com.amethyst.workflow.source.TavernaSource;
import br.com.amethyst.workflow.source.VistrailsSource;
import br.com.amethyst.workflow.source.XPDLSource;

/**
 * Factory of IWorkflowSources
 * @author Artur Figueira <arturfigueira@gmail.com>
 * @see IWorkflowSource
 */
public class WorkflowSourceFactory 
{
	/**
	 * Returns a new instance of WorkflowSource depending on type
	 * or null case this type is not yet implemented
	 * @param sourceType Type of the source to be chosen
	 * @return An instance of IWorkflowSource depending on type 
	 */
	public static IWorkflowSource newWorkflowSource(int sourceType)
	{
		IWorkflowSource source = null;
		
		switch (sourceType) 
		{
			case IWorkflowSource.WS_XPDL: source = new XPDLSource(); 
				break;
				
			case IWorkflowSource.WS_VISTRAILS: source = new VistrailsSource(); 
				break;
				
			case IWorkflowSource.WS_KEPLER: source = new KeplerSource(); 
				break;
				
			case IWorkflowSource.WS_TAVERNA: source = new TavernaSource(); 
				break;
		}
		
		return source;
	}
}
